// 全屏
export function fullscreenEnable() {
  const doc = document as Document & Record<string, any>;
  return Boolean(doc.isFullScreen || doc.mozIsFullScreen || doc.webkitIsFullScreen);
}

export function fullScreen() {
  const element = document.documentElement as HTMLElement & Record<string, any>;
  if (element.requestFullscreen) {
    element.requestFullscreen();
  } else if (element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if (element.webkitRequestFullscreen) {
    element.webkitRequestFullscreen();
  } else if (element.msRequestFullscreen) {
    element.msRequestFullscreen();
  }
}

export function exitFullScreen() {
  const element = document as Document & Record<string, any>;
  if (element.exitFullscreen) {
    element.exitFullscreen();
  } else if (element.mozCancelFullScreen) {
    element.mozCancelFullScreen();
  } else if (element.webkitExitFullscreen) {
    element.webkitExitFullscreen();
  } else if (element.msExitFullscreen) {
    element.msExitFullscreen();
  }
}
